package com.example.demo.server.model;

import com.example.demo.server.common.APPVariable;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Objects;


public class ArticleInfo {
    private int id;
    private String title;
    private String content;
    private String summary;
    private Timestamp createtime;
    private Timestamp updatetime;
    private int uid;
    private int rcount;
    private int state;

    public String getCreatetime() {
        return new SimpleDateFormat(APPVariable.DATA_FORMAT).format(createtime);
    }

    public void setCreatetime(Timestamp createtime) {
        this.createtime = createtime;
    }

    public String getUpdatetime() {
        return new SimpleDateFormat(APPVariable.DATA_FORMAT).format(updatetime);
    }

    public void setUpdatetime(Timestamp updatetime) {
        this.updatetime = updatetime;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public int getRcount() {
        return rcount;
    }

    public void setRcount(int rcount) {
        this.rcount = rcount;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ArticleInfo that = (ArticleInfo) o;
        return id == that.id && uid == that.uid && rcount == that.rcount && state == that.state && Objects.equals(title, that.title) && Objects.equals(content, that.content) && Objects.equals(summary, that.summary) && Objects.equals(createtime, that.createtime) && Objects.equals(updatetime, that.updatetime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, content, summary, createtime, updatetime, uid, rcount, state);
    }

    @Override
    public String toString() {
        return "ArticleInfo{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", summary='" + summary + '\'' +
                ", createtime=" + createtime +
                ", updatetime=" + updatetime +
                ", uid=" + uid +
                ", rcount=" + rcount +
                ", state=" + state +
                '}';
    }
}
